<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 数字类型
    var a = 1;
    // 字符串类型
    var str = '1';
    if(a == str){
        console.log('简单比较结果：相等！');
    }else{
        console.log('简单比较结果：不相等！');
    }
    if(a === str){
        console.log('完全比较结果：相等！');
    }else{
        console.log('完全比较结果：不相等！');
    }
    if(str === 1){
        console.log('str等于NaN');
    }else if(str == NaN){
        console.log('str等于NaN');
    }else{
        console.log('str等于字符串');
    }
    // 数组
    var arr = ['a','b','c'];
    arr[3] = 'd';
    arr.push('e');
    console.log(arr[0]);
    console.log(arr[1]);
    console.log(arr[2]);
    console.log(arr[3]);
    console.log(arr[4]);
    console.log(arr.length);

    // 布尔
    var val1 = true;
    var val2 = false;

    var a = 1;
    var b = 0;
    if(a == true){
        console.log('a等于true');
    }

    if(b == false){
        console.log('b等于false');
    }

    if(Array.isArray(arr)){
        console.log('是数组');
    }

    // 循环
    for (let index = 0; index < arr.length; index++) {
        console.log('第' + index + '个是：' + arr[index]);
    }

    var i = 0;
    while (i < arr.length) {
        console.log('while循环：第' + i + '个是：' + arr[i]);
        i++;
        // i = i +1;
    }

    var x = 0;
    do {
        console.log('dowhile循环：第' + x + '个是：' + arr[x]);
        x++;
    } while (x < arr.length);


    // undefined类型
    var y;
    console.log(y);


    // 对象
    var person = { name:'郑君全' , id:'44058219920711346X', phone: 17724254342, sex: '男'};
    console.log(person.name);
    console.log(person.id);
    console.log(person.phone);
    console.log(person.sex);
    person.name = 'james';
    console.log(person.name);
    person.age = 30;
    console.log(person.age);

    for (let k in person) {
        console.log(k + '：' + person[k]);
    }

    </script>
</html>